import pyamf
from django.contrib.auth import authenticate, login, logout
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User

try:
	pyamf.register_class(User, 'django.contrib.auth.models.User')
except ValueError:
	#already registered
	pass

def logout_user(request):
	logout(request)
	
def login_user(request, olr_username, olr_password):
	user = authenticate(username=olr_username, olr_password)
	if (user is not None):
		login(request, user)
		return user
	return None
	
@login_required
def get_all_users(request):
	return User.objects.all()
	